import Vue from 'vue'
import VueRouter from 'vue-router'
Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect: '/home/homedata/todayTenNewGoo'
  },
  {
    path: '/home',
    component: ()=>import('@/views/home'),
    children: [
      {
        path: 'homedata',
        component: () => import('../views/home/component/Homedata.vue'),
        children:[
          {
            path: 'todayTenNewGoo',
            component: () => import('../views/home/component/homedata/TodayTenNewGoos.vue')
          },
          {
            path: 'romorTenNewGoos',
            component: () => import('../views/home/component/homedata/RomorTenNewGoos.vue')
          }
        ],
        redirect: '/home/homedata/todayTenNewGoo'
      },
      {
        path: 'muandbady',
        component: () => import('../views/home/component/Muandbaby.vue')
      },
      {
        path: 'global',
        component: () => import('../views/home/component/Global.vue')
      },
      {
        path: 'luxury',
        component: () => import('../views/home/component/Luxury.vue')
      },
      {
        path: 'pop',
        component: () => import('../views/home/component/Pop.vue')
      },

    ],// 重定向=>当路由为home时重定向到homedata
    redirect: '/home/homedata/todayTenNewGoo'
  },
  //搜索动态路由
  {
    path: '/serach/index/:serachid',
    name: 'Describe',
    component: () => import('../views/home/component/serach/index')
  },
  {
    path: '/shoppingCart',
    component: ()=>import('@/views/shoppingCart')
  },
  {
    path: '/yiqituan',
    component: ()=>import('@/views/yiQiTuan')
  },
  {
    path: '/account/my',
    component: ()=>import('@/views/account'),
  },
  {
    path: '/login',// 登录路由
    component: () => import('../views/account/components/Login.vue')
  },
  {
    path: '/register',
    component: () => import('../views/account/components/Register.vue')
  },
  {
    path: '/detial',
    component: ()=>import('@/views/detial')
  },
  { // 一起团商品详情路由
    path: '/yiqituan/detial',
    name: 'yiqituan-detial',
    component: ()=>import('@/views/yiQiTuan/detial')
  },
  { // 正常商品详情
    path: '/product/detial',
    name: 'product-detial',
    component: ()=>import('@/views/home/detial')
  },
  { // 正常商品详情
    path: '/test',
    component: ()=>import('@/views/test')
  },
  {
    path: '/shop',
    name: 'shop',
    component: ()=>import('@/views/shop')
  },
  // {
  //   path: '/yiqituan/detial',
  //   component: ()=>import('@/views/detial')
  // },
  // {
  //   path: '*',
  //   redirect: '/home'
  // }
]

const router = new VueRouter({
  routes
})

export default router
